<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="content-type" content="text/html; charset=utf-8" />
        <title>Site Manager</title>
        <link rel="stylesheet" type="text/css" href="<?= base_url(); ?>css/admin/reset.css" media="screen" />
        <link rel="stylesheet" type="text/css" href="<?= base_url(); ?>css/admin/text.css" media="screen" />
        <link rel="stylesheet" type="text/css" href="<?= base_url(); ?>css/admin/grid.css" media="screen" />
        <link rel="stylesheet" type="text/css" href="<?= base_url(); ?>css/admin/layout.css" media="screen" />
        <link rel="stylesheet" type="text/css" href="<?= base_url(); ?>css/admin/nav.css" media="screen" />
        <link rel="stylesheet" type="text/css" href="<?= base_url(); ?>css/admin/custom.css" media="screen" />
        <!--[if IE 6]><link rel="stylesheet" type="text/css" href="../css/ie6.css" media="screen" /><![endif]-->
        <!--[if IE 7]><link rel="stylesheet" type="text/css" href="../css/ie.css" media="screen" /><![endif]-->


    </head>
    <body >
        <div class="container_16" >

            <?php include 'admin_header.php'; ?>

            <!-- Left Menu Panel !-->

            <?php include 'admin_left_menu.php'; ?>


            <!-- Content Panel -->	
            <div class="grid_7">
                <div class="box">
                    <h2>
                        <a href="#" id="toggle-tables">SPECIFICATION MANAGEMENT |  
                            <?= $this->management_model->get_make('CAR', $make_id)->make; ?> |
                            <?= $this->management_model->get_model('CAR', $model_id)->model; ?> |
                            <?= $this->management_model->get_version('CAR', $version_id)->version; ?> 
                        </a>
                    </h2>
                    <div class="block" >
                        <form name="admin-form" action="<?= base_url(); ?>admin/management/car_version_specification_insert" method="post">
                            <fieldset>
                                <legend>SPECIFICATION </legend>
                                <div class="field" >
                                    <?php
                                    if ($this->session->flashdata('message')) {
                                        $msg = $this->session->flashdata('message');
                                        echo '<font color="red">' . $msg . '</font>';
                                    }
                                    ?> 
                                </div>
                                <div class="field" style="float:left; margin-right: 5px;">
                                    <label> Select a Specification</label>
                                    <select name="specification" style="width: 250px">
                                        <option value=""> Select Specification</option>
                                        <?php foreach ($specification as $specification): ?>
                                            <option value="<?= $specification->slno . ',' . $specification->code ?>"> <?= $specification->specification; ?> </option>
                                        <?php endforeach; ?>
                                    </select>
                                </div>
                                <div class="field" style="float:left;">
                                    <label>Specification Value </label>
                                    <input type="text" name="specification_value" value="" size="40"/>
                                    <input type="hidden" name="version_id" value="<?= $version_id; ?>"/>
                                    <input type="hidden" name="model_id" value="<?= $model_id; ?>"/>
                                    <input type="hidden" name="make_id" value="<?= $make_id; ?>"/>
                                    <input type="submit" value="Add Now" name="insert_specification"/>
                                </div>
                                <div style="float:right;">
                                    <?php $img = $this->management_model->get_version_image('CAR', $version_id);
                                    if ($img != '') { ?>
                                        <img style="border: 1px solid #CCC; padding: 3px" src="<?= base_url() ?>images/car/version/<?= $img; ?>" height="75" width="188" align="center"/>
                                    <?php } ?>
                                </div>
                            </fieldset>
                        </form>
                        <?php
                        foreach ($version_specification_code as $version_specification_code):
                            $version_specifications = $this->management_model->get_specification_by_version_id('CAR', $version_id, $version_specification_code->code);
                            ?>
                            <fieldset>
                                <legend id="red">
                                    <?= $this->management_model->specification_type($version_specification_code->code); ?> :
                                </legend>
                                <?php
                                foreach ($version_specifications as $version_specifications):
                                    ?>
                                    <div class="field">
                                        <input type="text" size="70" disabled="disabled" value="<?= $version_specifications->specification; ?>"/>
                                        <input type="text" size="40" disabled="disabled" value="<?= $this->management_model->get_specification_value('CAR', $version_specifications->slno, $version_specification_code->code); ?>"/>
                                        <a href="<?= base_url(); ?>admin/management/delete_specification/<?= $version_specifications->slno; ?>/<?= $version_specification_code->code; ?>" class="link-button" style="float: right" onclick="return confirm('Are you sure you want to Delete?')"> Delete </a>
                                    </div>
                                    <?php endforeach; ?>
                            </fieldset>
                            <?php endforeach; ?>
                    </div>
                </div> <!-- END OF BOX -->
            </div>
            <!-- comfort start -->
            <div class="grid_16" id="site_info">
                <div class="box">
                    <p><?= $this->settings_model->get_setting('webtitle'); ?></p>
                </div>
            </div>
            <div class="clear"></div>
        </div>
        <script type="text/javascript" src="<?= base_url(); ?>js/admin/mootools-1.2.1-core.js"></script>
        <script type="text/javascript" src="<?= base_url(); ?>js/admin/mootools-1.2-more.js"></script>
        <script type="text/javascript" src="<?= base_url(); ?>js/admin/mootools-fluid16-autoselect.js"></script>
    </body>
</html>